﻿'// ========================================================================= '
'// ------------------------------------------------------------------------- '
'//!				\file		CST_Symbols.vb
'			        \date		june 2010
'			        \author		TNick
'
'			        \brief		Dialog for symbols settings
'
'
'   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'   This file is considered universal knowledge. No restrictions
'   are imposed; use as you see fit.
'   Please read ReadMe.txt and Licence.txt in root folder
'   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
'   
'
'// ------------------------------------------------------------------------- '
'// ========================================================================= '
'//
'//
'//
'//
'//  IMPORTS     ------------------------------------------------------------ '
#Region "Imports"

Imports Autodesk.AutoCAD.ApplicationServices

#End Region
'//  IMPORTS     ============================================================ '
'//
'//
'//
'//
'//  DEFINITIONS    --------------------------------------------------------- '




'//  DEFINITIONS    ========================================================= '
'//
'//
'//
'//
'//  DATA    ---------------------------------------------------------------- '


'//  DATA    ================================================================ '
'//
'//
'//
'//
'//  CLASS    --------------------------------------------------------------- '

Public Class CST_Symbols

    '// --------------------------------------------------------------------- '
    Private Sub OK_Button_Click(ByVal sender As System.Object, _
                                ByVal e As System.EventArgs) _
                                Handles OK_Button.Click
        

        CM_Symbols.Stgs.sDBPath = Me.tx_DB.Text

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
    Private Sub Cancel_Button_Click(ByVal sender As System.Object, _
                                    ByVal e As System.EventArgs) _
                                    Handles Cancel_Button.Click
        
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub
    '// ===================================================================== '


    '// --------------------------------------------------------------------- '
    Private Sub CST_Symbols_Load( _
        ByVal sender As System.Object,  _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load

        Me.Text = CMain._T(TX.SYMBOLS) & ". " & _
                CMain._T(TX.SETTINGS) & "."
        Me.OK_Button.Text = CMain._T(TX.OK)
        Me.Cancel_Button.Text = CMain._T(TX.CANCEL)

        Me.TP_Dbf.Text = CMain._T(TX.DBF)
        Me.B_View.Text = CMain._T(TX.VIEW)
        Me.B_Browse.Text = CMain._T(TX.CHOOSE)

        Me.tx_DB.Text = CM_Symbols.Stgs.sDBPath

    End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
    Private Sub B_View_Click( _
        ByVal sender As System.Object,  _
        ByVal e As System.EventArgs) _
        Handles B_View.Click

		Try

            Dim acDocMgr As DocumentCollection = _
                Application.DocumentManager
            If (System.IO.File.Exists(Me.tx_DB.Text)) Then
                acDocMgr.Open(Me.tx_DB.Text, False)
            Else
                MsgBox(CMain._T(TX.ERR_FILE))
            End If

		Catch ex As System.Exception
			CMain.DebugException(ex)
		End Try

    End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
    Private Sub B_Browse_Click( _
        ByVal sender As System.Object,  _
        ByVal e As System.EventArgs) _
        Handles B_Browse.Click

		Try

            Dim fdlg As System.Windows.Forms.OpenFileDialog = _
                New System.Windows.Forms.OpenFileDialog()
            fdlg.Title = Me.Text
            fdlg.FileName = Me.tx_DB.Text
            fdlg.Filter = "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*"
            fdlg.FilterIndex = 1
            fdlg.RestoreDirectory = False
            If fdlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
                Me.tx_DB.Text = fdlg.FileName 
            End If


		Catch ex As System.Exception
			CMain.DebugException(ex)
		End Try


    End Sub
    '// ===================================================================== '



End Class

'//  CLASS    =============================================================== '
'//
'//
'//
'//
'//  FUNCTIONS    ----------------------------------------------------------- '

'//  FUNCTIONS    =========================================================== '
'//
'//
'//
'//
'// ------------------------------------------------------------------------- '
'// ========================================================================= '
